@extends("/paging_template")
@import com.mgfireworks.mgplatform.mgadmin.sys.model.Area
@import com.mgfireworks.mgplatform.mgadmin.constants.AreaLevel
@args List<Area> areaList
<s_panel>
	<s_title slot="title">请选择区域</s_title>
	<s_input name="areaName" text="区域名称"></s_input>
	<s_select name="areaLevel" text="区域级别" value="@val("areaLevel")">
	@for(AreaLevel level : AreaLevel.values()){
		<option value="@level.value()">@level.getPhrase()</option>
	}
	</s_select>
	<s_input name="parentArea" text="父级名称"></s_input>
	<s_buttons slot="button" cols="2">
		<s_button id="jsBtnSelect" type="select">选择</s_button>
		<s_button id="jsBtnCancelAndBack" type="del">取消</s_button>
	</s_buttons>
</s_panel>
<d_table>
	<d_tr slot="head">
		<d_th class="td_row_id"></d_th>
		<d_th>区域编号</d_th>
		<d_th>区域名称</d_th>
		<d_th>区域级别</d_th>
		<d_th>父级名称</d_th>
	</d_tr>
	@if(areaList){
	@{int i=0;}
	@for(Area p : areaList){
	<d_tr slot="body" class="table_row @(i%2==0?"odd":"event")">
	@{i++;}
	<d_td class="td_row_id">
		<input type="checkbox" class="flat" name="__recordId" value="@p.getAreaId()"/>
	</d_td>
	<d_td>@p.getAreaId()</d_td>
	<d_td>@p.getAreaName()</d_td>
	<d_td>@AreaLevel.valueOf(p.getAreaLevel())</d_td>
	<d_td>@p.getParentArea()</d_td>
	</d_tr>
	}}
</d_table>
@section(script1){
<script type="text/javascript">
    $(function(){
        $("#jsBtnSelect").unbind("click").click(function() {
            var tds=$(".table_row.selected td");
            if(tds.length>0){
                util.el.postBack({areaId:$(tds[1]).text(),areaName:$(tds[2]).text()});
            }
            return false;
        });
    });
</script>
}